{
  "nbformat": 4,
  "nbformat_minor": 0,
  "metadata": {
    "colab": {
      "provenance": [],
      "authorship_tag": "ABX9TyNup94IBEx/pkX8p8F53iQe",
      "include_colab_link": true
    },
    "kernelspec": {
      "name": "python3",
      "display_name": "Python 3"
    },
    "language_info": {
      "name": "python"
    },
    "accelerator": "GPU",
    "gpuClass": "standard"
  },
  "cells": [
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "view-in-github",
        "colab_type": "text"
      },
      "source": [
        "<a href=\"https://colab.research.google.com/github/chenyu313/Colaboratory_note/blob/main/%E9%80%9A%E8%BF%87CLI%E9%85%8D%E7%BD%AE%E8%B6%85%E5%8F%82%E6%95%B0.ipynb\" target=\"_parent\"><img src=\"https://colab.research.google.com/assets/colab-badge.svg\" alt=\"Open In Colab\"/></a>"
      ]
    },
    {
      "cell_type": "markdown",
      "source": [
        "## 通过CLI配置超参数\n",
        "\n",
        "你可以在Lightning中使用任何你想要的CLI工具。对于初学者，我们建议使用Python内置的参数解析器。\n",
        "\n",
        "## ArgumentParser\n",
        "ArgumentParser是Python中的一个内置特性，可以让你构建CLI程序。你可以使用它在命令行中提供超参数和其他训练设置:"
      ],
      "metadata": {
        "id": "3BvM7EDSs6q3"
      }
    },
    {
      "cell_type": "markdown",
      "source": [
        "这允许你像这样调用你的程序:"
      ],
      "metadata": {
        "id": "ZmjneU3PtN9e"
      }
    },
    {
      "cell_type": "code",
      "source": [
        "! pip install --quiet \"seaborn\" \"pytorch-lightning>=1.4, <2.0.0\" \"torchvision\" \"setuptools==67.4.0\" \"lightning>=2.0.0rc0\" \"ipython[notebook]==7.9.0\" \"pandas\" \"torchmetrics >=0.11.0\" \"torch>=1.8.1, <1.14.0\" \"torchmetrics>=0.7, <0.12\""
      ],
      "metadata": {
        "id": "AVnY_OHkt6xv"
      },
      "execution_count": null,
      "outputs": []
    },
    {
      "cell_type": "code",
      "execution_count": 10,
      "metadata": {
        "colab": {
          "base_uri": "https://localhost:8080/"
        },
        "id": "kDpLE-HSr-Hx",
        "outputId": "e12553ac-527d-4b76-a81b-ef01167ab617"
      },
      "outputs": [
        {
          "output_type": "stream",
          "name": "stdout",
          "text": [
            "/usr/local/lib/python3.9/dist-packages/lightning/fabric/accelerators/cuda.py:235: UserWarning: Can't initialize NVML\n",
            "  warnings.warn(\"Can't initialize NVML\")\n",
            "/usr/local/lib/python3.9/dist-packages/torch/cuda/__init__.py:497: UserWarning: Can't initialize NVML\n",
            "  warnings.warn(\"Can't initialize NVML\")\n",
            "GPU available: False, used: False\n",
            "TPU available: False, using: 0 TPU cores\n",
            "IPU available: False, using: 0 IPUs\n",
            "HPU available: False, using: 0 HPUs\n",
            "\n",
            "  | Name          | Type               | Params\n",
            "-----------------------------------------------------\n",
            "0 | model         | Sequential         | 55.1 K\n",
            "1 | val_accuracy  | MulticlassAccuracy | 0     \n",
            "2 | test_accuracy | MulticlassAccuracy | 0     \n",
            "-----------------------------------------------------\n",
            "55.1 K    Trainable params\n",
            "0         Non-trainable params\n",
            "55.1 K    Total params\n",
            "0.220     Total estimated model params size (MB)\n",
            "2023-03-30 13:45:18.259039: I tensorflow/core/platform/cpu_feature_guard.cc:193] This TensorFlow binary is optimized with oneAPI Deep Neural Network Library (oneDNN) to use the following CPU instructions in performance-critical operations:  AVX2 FMA\n",
            "To enable them in other operations, rebuild TensorFlow with the appropriate compiler flags.\n",
            "2023-03-30 13:45:19.709318: W tensorflow/compiler/xla/stream_executor/platform/default/dso_loader.cc:64] Could not load dynamic library 'libnvinfer.so.7'; dlerror: libnvinfer.so.7: cannot open shared object file: No such file or directory; LD_LIBRARY_PATH: /usr/local/nvidia/lib:/usr/local/nvidia/lib64\n",
            "2023-03-30 13:45:19.709796: W tensorflow/compiler/xla/stream_executor/platform/default/dso_loader.cc:64] Could not load dynamic library 'libnvinfer_plugin.so.7'; dlerror: libnvinfer_plugin.so.7: cannot open shared object file: No such file or directory; LD_LIBRARY_PATH: /usr/local/nvidia/lib:/usr/local/nvidia/lib64\n",
            "2023-03-30 13:45:19.709837: W tensorflow/compiler/tf2tensorrt/utils/py_utils.cc:38] TF-TRT Warning: Cannot dlopen some TensorRT libraries. If you would like to use Nvidia GPU with TensorRT, please make sure the missing libraries mentioned above are installed properly.\n",
            "Epoch 0: 100% 860/860 [00:22<00:00, 38.63it/s, v_num=1]\n",
            "Validation: 0it [00:00, ?it/s]\u001b[A\n",
            "Validation:   0% 0/79 [00:00<?, ?it/s]\u001b[A\n",
            "Validation DataLoader 0:   0% 0/79 [00:00<?, ?it/s]\u001b[A\n",
            "Validation DataLoader 0:   1% 1/79 [00:00<00:00, 490.85it/s]\u001b[A\n",
            "Validation DataLoader 0:   3% 2/79 [00:00<00:00, 83.22it/s] \u001b[A\n",
            "Validation DataLoader 0:   4% 3/79 [00:00<00:01, 62.45it/s]\u001b[A\n",
            "Validation DataLoader 0:   5% 4/79 [00:00<00:01, 60.30it/s]\u001b[A\n",
            "Validation DataLoader 0:   6% 5/79 [00:00<00:01, 59.18it/s]\u001b[A\n",
            "Validation DataLoader 0:   8% 6/79 [00:00<00:01, 58.87it/s]\u001b[A\n",
            "Validation DataLoader 0:   9% 7/79 [00:00<00:01, 54.45it/s]\u001b[A\n",
            "Validation DataLoader 0:  10% 8/79 [00:00<00:01, 53.69it/s]\u001b[A\n",
            "Validation DataLoader 0:  11% 9/79 [00:00<00:01, 53.32it/s]\u001b[A\n",
            "Validation DataLoader 0:  13% 10/79 [00:00<00:01, 53.61it/s]\u001b[A\n",
            "Validation DataLoader 0:  14% 11/79 [00:00<00:01, 53.73it/s]\u001b[A\n",
            "Validation DataLoader 0:  15% 12/79 [00:00<00:01, 53.54it/s]\u001b[A\n",
            "Validation DataLoader 0:  16% 13/79 [00:00<00:01, 51.92it/s]\u001b[A\n",
            "Validation DataLoader 0:  18% 14/79 [00:00<00:01, 52.24it/s]\u001b[A\n",
            "Validation DataLoader 0:  19% 15/79 [00:00<00:01, 52.40it/s]\u001b[A\n",
            "Validation DataLoader 0:  20% 16/79 [00:00<00:01, 52.69it/s]\u001b[A\n",
            "Validation DataLoader 0:  22% 17/79 [00:00<00:01, 52.80it/s]\u001b[A\n",
            "Validation DataLoader 0:  23% 18/79 [00:00<00:01, 52.17it/s]\u001b[A\n",
            "Validation DataLoader 0:  24% 19/79 [00:00<00:01, 52.35it/s]\u001b[A\n",
            "Validation DataLoader 0:  25% 20/79 [00:00<00:01, 52.58it/s]\u001b[A\n",
            "Validation DataLoader 0:  27% 21/79 [00:00<00:01, 52.55it/s]\u001b[A\n",
            "Validation DataLoader 0:  28% 22/79 [00:00<00:01, 52.70it/s]\u001b[A\n",
            "Validation DataLoader 0:  29% 23/79 [00:00<00:01, 52.61it/s]\u001b[A\n",
            "Validation DataLoader 0:  30% 24/79 [00:00<00:01, 52.79it/s]\u001b[A\n",
            "Validation DataLoader 0:  32% 25/79 [00:00<00:01, 52.86it/s]\u001b[A\n",
            "Validation DataLoader 0:  33% 26/79 [00:00<00:00, 53.01it/s]\u001b[A\n",
            "Validation DataLoader 0:  34% 27/79 [00:00<00:00, 53.11it/s]\u001b[A\n",
            "Validation DataLoader 0:  35% 28/79 [00:00<00:00, 53.21it/s]\u001b[A\n",
            "Validation DataLoader 0:  37% 29/79 [00:00<00:00, 53.22it/s]\u001b[A\n",
            "Validation DataLoader 0:  38% 30/79 [00:00<00:00, 53.33it/s]\u001b[A\n",
            "Validation DataLoader 0:  39% 31/79 [00:00<00:00, 53.40it/s]\u001b[A\n",
            "Validation DataLoader 0:  41% 32/79 [00:00<00:00, 53.49it/s]\u001b[A\n",
            "Validation DataLoader 0:  42% 33/79 [00:00<00:00, 53.53it/s]\u001b[A\n",
            "Validation DataLoader 0:  43% 34/79 [00:00<00:00, 53.50it/s]\u001b[A\n",
            "Validation DataLoader 0:  44% 35/79 [00:00<00:00, 53.24it/s]\u001b[A\n",
            "Validation DataLoader 0:  46% 36/79 [00:00<00:00, 53.35it/s]\u001b[A\n",
            "Validation DataLoader 0:  47% 37/79 [00:00<00:00, 53.39it/s]\u001b[A\n",
            "Validation DataLoader 0:  48% 38/79 [00:00<00:00, 53.45it/s]\u001b[A\n",
            "Validation DataLoader 0:  49% 39/79 [00:00<00:00, 53.51it/s]\u001b[A\n",
            "Validation DataLoader 0:  51% 40/79 [00:00<00:00, 53.52it/s]\u001b[A\n",
            "Validation DataLoader 0:  52% 41/79 [00:00<00:00, 53.42it/s]\u001b[A\n",
            "Validation DataLoader 0:  53% 42/79 [00:00<00:00, 53.50it/s]\u001b[A\n",
            "Validation DataLoader 0:  54% 43/79 [00:00<00:00, 53.53it/s]\u001b[A\n",
            "Validation DataLoader 0:  56% 44/79 [00:00<00:00, 53.52it/s]\u001b[A\n",
            "Validation DataLoader 0:  57% 45/79 [00:00<00:00, 53.47it/s]\u001b[A\n",
            "Validation DataLoader 0:  58% 46/79 [00:00<00:00, 53.31it/s]\u001b[A\n",
            "Validation DataLoader 0:  59% 47/79 [00:00<00:00, 53.22it/s]\u001b[A\n",
            "Validation DataLoader 0:  61% 48/79 [00:00<00:00, 53.10it/s]\u001b[A\n",
            "Validation DataLoader 0:  62% 49/79 [00:00<00:00, 53.09it/s]\u001b[A\n",
            "Validation DataLoader 0:  63% 50/79 [00:00<00:00, 52.96it/s]\u001b[A\n",
            "Validation DataLoader 0:  65% 51/79 [00:00<00:00, 52.93it/s]\u001b[A\n",
            "Validation DataLoader 0:  66% 52/79 [00:00<00:00, 52.92it/s]\u001b[A\n",
            "Validation DataLoader 0:  67% 53/79 [00:01<00:00, 52.93it/s]\u001b[A\n",
            "Validation DataLoader 0:  68% 54/79 [00:01<00:00, 52.99it/s]\u001b[A\n",
            "Validation DataLoader 0:  70% 55/79 [00:01<00:00, 53.01it/s]\u001b[A\n",
            "Validation DataLoader 0:  71% 56/79 [00:01<00:00, 52.99it/s]\u001b[A\n",
            "Validation DataLoader 0:  72% 57/79 [00:01<00:00, 53.00it/s]\u001b[A\n",
            "Validation DataLoader 0:  73% 58/79 [00:01<00:00, 53.00it/s]\u001b[A\n",
            "Validation DataLoader 0:  75% 59/79 [00:01<00:00, 53.01it/s]\u001b[A\n",
            "Validation DataLoader 0:  76% 60/79 [00:01<00:00, 53.07it/s]\u001b[A\n",
            "Validation DataLoader 0:  77% 61/79 [00:01<00:00, 52.56it/s]\u001b[A\n",
            "Validation DataLoader 0:  78% 62/79 [00:01<00:00, 52.57it/s]\u001b[A\n",
            "Validation DataLoader 0:  80% 63/79 [00:01<00:00, 52.59it/s]\u001b[A\n",
            "Validation DataLoader 0:  81% 64/79 [00:01<00:00, 52.56it/s]\u001b[A\n",
            "Validation DataLoader 0:  82% 65/79 [00:01<00:00, 52.46it/s]\u001b[A\n",
            "Validation DataLoader 0:  84% 66/79 [00:01<00:00, 52.35it/s]\u001b[A\n",
            "Validation DataLoader 0:  85% 67/79 [00:01<00:00, 52.37it/s]\u001b[A\n",
            "Validation DataLoader 0:  86% 68/79 [00:01<00:00, 52.34it/s]\u001b[A\n",
            "Validation DataLoader 0:  87% 69/79 [00:01<00:00, 52.36it/s]\u001b[A\n",
            "Validation DataLoader 0:  89% 70/79 [00:01<00:00, 52.34it/s]\u001b[A\n",
            "Validation DataLoader 0:  90% 71/79 [00:01<00:00, 52.35it/s]\u001b[A\n",
            "Validation DataLoader 0:  91% 72/79 [00:01<00:00, 52.15it/s]\u001b[A\n",
            "Validation DataLoader 0:  92% 73/79 [00:01<00:00, 52.18it/s]\u001b[A\n",
            "Validation DataLoader 0:  94% 74/79 [00:01<00:00, 52.21it/s]\u001b[A\n",
            "Validation DataLoader 0:  95% 75/79 [00:01<00:00, 52.24it/s]\u001b[A\n",
            "Validation DataLoader 0:  96% 76/79 [00:01<00:00, 52.26it/s]\u001b[A\n",
            "Validation DataLoader 0:  97% 77/79 [00:01<00:00, 52.27it/s]\u001b[A\n",
            "Validation DataLoader 0:  99% 78/79 [00:01<00:00, 52.25it/s]\u001b[A\n",
            "Epoch 0: 100% 860/860 [00:23<00:00, 36.17it/s, v_num=1, val_loss=0.282, val_acc=0.921]\n",
            "Epoch 1: 100% 860/860 [00:20<00:00, 41.39it/s, v_num=1, val_loss=0.282, val_acc=0.921]\n",
            "Validation: 0it [00:00, ?it/s]\u001b[A\n",
            "Validation:   0% 0/79 [00:00<?, ?it/s]\u001b[A\n",
            "Validation DataLoader 0:   0% 0/79 [00:00<?, ?it/s]\u001b[A\n",
            "Validation DataLoader 0:   1% 1/79 [00:00<00:00, 477.93it/s]\u001b[A\n",
            "Validation DataLoader 0:   3% 2/79 [00:00<00:00, 100.62it/s]\u001b[A\n",
            "Validation DataLoader 0:   4% 3/79 [00:00<00:00, 79.00it/s] \u001b[A\n",
            "Validation DataLoader 0:   5% 4/79 [00:00<00:01, 72.03it/s]\u001b[A\n",
            "Validation DataLoader 0:   6% 5/79 [00:00<00:01, 66.23it/s]\u001b[A\n",
            "Validation DataLoader 0:   8% 6/79 [00:00<00:01, 64.29it/s]\u001b[A\n",
            "Validation DataLoader 0:   9% 7/79 [00:00<00:01, 62.17it/s]\u001b[A\n",
            "Validation DataLoader 0:  10% 8/79 [00:00<00:01, 61.46it/s]\u001b[A\n",
            "Validation DataLoader 0:  11% 9/79 [00:00<00:01, 60.67it/s]\u001b[A\n",
            "Validation DataLoader 0:  13% 10/79 [00:00<00:01, 60.23it/s]\u001b[A\n",
            "Validation DataLoader 0:  14% 11/79 [00:00<00:01, 59.61it/s]\u001b[A\n",
            "Validation DataLoader 0:  15% 12/79 [00:00<00:01, 59.26it/s]\u001b[A\n",
            "Validation DataLoader 0:  16% 13/79 [00:00<00:01, 59.01it/s]\u001b[A\n",
            "Validation DataLoader 0:  18% 14/79 [00:00<00:01, 58.83it/s]\u001b[A\n",
            "Validation DataLoader 0:  19% 15/79 [00:00<00:01, 58.64it/s]\u001b[A\n",
            "Validation DataLoader 0:  20% 16/79 [00:00<00:01, 57.61it/s]\u001b[A\n",
            "Validation DataLoader 0:  22% 17/79 [00:00<00:01, 57.28it/s]\u001b[A\n",
            "Validation DataLoader 0:  23% 18/79 [00:00<00:01, 57.30it/s]\u001b[A\n",
            "Validation DataLoader 0:  24% 19/79 [00:00<00:01, 57.13it/s]\u001b[A\n",
            "Validation DataLoader 0:  25% 20/79 [00:00<00:01, 57.14it/s]\u001b[A\n",
            "Validation DataLoader 0:  27% 21/79 [00:00<00:01, 56.96it/s]\u001b[A\n",
            "Validation DataLoader 0:  28% 22/79 [00:00<00:01, 56.87it/s]\u001b[A\n",
            "Validation DataLoader 0:  29% 23/79 [00:00<00:00, 56.79it/s]\u001b[A\n",
            "Validation DataLoader 0:  30% 24/79 [00:00<00:00, 56.78it/s]\u001b[A\n",
            "Validation DataLoader 0:  32% 25/79 [00:00<00:00, 56.71it/s]\u001b[A\n",
            "Validation DataLoader 0:  33% 26/79 [00:00<00:00, 56.46it/s]\u001b[A\n",
            "Validation DataLoader 0:  34% 27/79 [00:00<00:00, 56.38it/s]\u001b[A\n",
            "Validation DataLoader 0:  35% 28/79 [00:00<00:00, 56.24it/s]\u001b[A\n",
            "Validation DataLoader 0:  37% 29/79 [00:00<00:00, 55.35it/s]\u001b[A\n",
            "Validation DataLoader 0:  38% 30/79 [00:00<00:00, 55.04it/s]\u001b[A\n",
            "Validation DataLoader 0:  39% 31/79 [00:00<00:00, 54.96it/s]\u001b[A\n",
            "Validation DataLoader 0:  41% 32/79 [00:00<00:00, 54.41it/s]\u001b[A\n",
            "Validation DataLoader 0:  42% 33/79 [00:00<00:00, 54.33it/s]\u001b[A\n",
            "Validation DataLoader 0:  43% 34/79 [00:00<00:00, 54.28it/s]\u001b[A\n",
            "Validation DataLoader 0:  44% 35/79 [00:00<00:00, 54.29it/s]\u001b[A\n",
            "Validation DataLoader 0:  46% 36/79 [00:00<00:00, 54.33it/s]\u001b[A\n",
            "Validation DataLoader 0:  47% 37/79 [00:00<00:00, 54.17it/s]\u001b[A\n",
            "Validation DataLoader 0:  48% 38/79 [00:00<00:00, 54.24it/s]\u001b[A\n",
            "Validation DataLoader 0:  49% 39/79 [00:00<00:00, 54.08it/s]\u001b[A\n",
            "Validation DataLoader 0:  51% 40/79 [00:00<00:00, 53.56it/s]\u001b[A\n",
            "Validation DataLoader 0:  52% 41/79 [00:00<00:00, 53.43it/s]\u001b[A\n",
            "Validation DataLoader 0:  53% 42/79 [00:00<00:00, 53.44it/s]\u001b[A\n",
            "Validation DataLoader 0:  54% 43/79 [00:00<00:00, 53.43it/s]\u001b[A\n",
            "Validation DataLoader 0:  56% 44/79 [00:00<00:00, 53.46it/s]\u001b[A\n",
            "Validation DataLoader 0:  57% 45/79 [00:00<00:00, 53.46it/s]\u001b[A\n",
            "Validation DataLoader 0:  58% 46/79 [00:00<00:00, 53.50it/s]\u001b[A\n",
            "Validation DataLoader 0:  59% 47/79 [00:00<00:00, 53.21it/s]\u001b[A\n",
            "Validation DataLoader 0:  61% 48/79 [00:00<00:00, 53.20it/s]\u001b[A\n",
            "Validation DataLoader 0:  62% 49/79 [00:00<00:00, 53.23it/s]\u001b[A\n",
            "Validation DataLoader 0:  63% 50/79 [00:00<00:00, 53.28it/s]\u001b[A\n",
            "Validation DataLoader 0:  65% 51/79 [00:00<00:00, 53.31it/s]\u001b[A\n",
            "Validation DataLoader 0:  66% 52/79 [00:00<00:00, 53.22it/s]\u001b[A\n",
            "Validation DataLoader 0:  67% 53/79 [00:00<00:00, 53.25it/s]\u001b[A\n",
            "Validation DataLoader 0:  68% 54/79 [00:01<00:00, 53.27it/s]\u001b[A\n",
            "Validation DataLoader 0:  70% 55/79 [00:01<00:00, 53.30it/s]\u001b[A\n",
            "Validation DataLoader 0:  71% 56/79 [00:01<00:00, 53.26it/s]\u001b[A\n",
            "Validation DataLoader 0:  72% 57/79 [00:01<00:00, 53.23it/s]\u001b[A\n",
            "Validation DataLoader 0:  73% 58/79 [00:01<00:00, 53.26it/s]\u001b[A\n",
            "Validation DataLoader 0:  75% 59/79 [00:01<00:00, 53.30it/s]\u001b[A\n",
            "Validation DataLoader 0:  76% 60/79 [00:01<00:00, 53.34it/s]\u001b[A\n",
            "Validation DataLoader 0:  77% 61/79 [00:01<00:00, 53.30it/s]\u001b[A\n",
            "Validation DataLoader 0:  78% 62/79 [00:01<00:00, 53.27it/s]\u001b[A\n",
            "Validation DataLoader 0:  80% 63/79 [00:01<00:00, 52.98it/s]\u001b[A\n",
            "Validation DataLoader 0:  81% 64/79 [00:01<00:00, 52.99it/s]\u001b[A\n",
            "Validation DataLoader 0:  82% 65/79 [00:01<00:00, 53.01it/s]\u001b[A\n",
            "Validation DataLoader 0:  84% 66/79 [00:01<00:00, 53.05it/s]\u001b[A\n",
            "Validation DataLoader 0:  85% 67/79 [00:01<00:00, 52.94it/s]\u001b[A\n",
            "Validation DataLoader 0:  86% 68/79 [00:01<00:00, 52.90it/s]\u001b[A\n",
            "Validation DataLoader 0:  87% 69/79 [00:01<00:00, 52.90it/s]\u001b[A\n",
            "Validation DataLoader 0:  89% 70/79 [00:01<00:00, 52.91it/s]\u001b[A\n",
            "Validation DataLoader 0:  90% 71/79 [00:01<00:00, 52.88it/s]\u001b[A\n",
            "Validation DataLoader 0:  91% 72/79 [00:01<00:00, 52.88it/s]\u001b[A\n",
            "Validation DataLoader 0:  92% 73/79 [00:01<00:00, 52.80it/s]\u001b[A\n",
            "Validation DataLoader 0:  94% 74/79 [00:01<00:00, 52.83it/s]\u001b[A\n",
            "Validation DataLoader 0:  95% 75/79 [00:01<00:00, 52.83it/s]\u001b[A\n",
            "Validation DataLoader 0:  96% 76/79 [00:01<00:00, 52.88it/s]\u001b[A\n",
            "Validation DataLoader 0:  97% 77/79 [00:01<00:00, 52.85it/s]\u001b[A\n",
            "Validation DataLoader 0:  99% 78/79 [00:01<00:00, 52.89it/s]\u001b[A\n",
            "Epoch 1: 100% 860/860 [00:22<00:00, 38.60it/s, v_num=1, val_loss=0.219, val_acc=0.936]\n",
            "Epoch 2: 100% 860/860 [00:21<00:00, 39.29it/s, v_num=1, val_loss=0.219, val_acc=0.936]\n",
            "Validation: 0it [00:00, ?it/s]\u001b[A\n",
            "Validation:   0% 0/79 [00:00<?, ?it/s]\u001b[A\n",
            "Validation DataLoader 0:   0% 0/79 [00:00<?, ?it/s]\u001b[A\n",
            "Validation DataLoader 0:   1% 1/79 [00:00<00:00, 352.26it/s]\u001b[A\n",
            "Validation DataLoader 0:   3% 2/79 [00:00<00:01, 70.02it/s] \u001b[A\n",
            "Validation DataLoader 0:   4% 3/79 [00:00<00:01, 49.87it/s]\u001b[A\n",
            "Validation DataLoader 0:   5% 4/79 [00:00<00:01, 47.05it/s]\u001b[A\n",
            "Validation DataLoader 0:   6% 5/79 [00:00<00:01, 44.20it/s]\u001b[A\n",
            "Validation DataLoader 0:   8% 6/79 [00:00<00:01, 42.93it/s]\u001b[A\n",
            "Validation DataLoader 0:   9% 7/79 [00:00<00:01, 42.17it/s]\u001b[A\n",
            "Validation DataLoader 0:  10% 8/79 [00:00<00:01, 41.71it/s]\u001b[A\n",
            "Validation DataLoader 0:  11% 9/79 [00:00<00:01, 40.70it/s]\u001b[A\n",
            "Validation DataLoader 0:  13% 10/79 [00:00<00:01, 39.34it/s]\u001b[A\n",
            "Validation DataLoader 0:  14% 11/79 [00:00<00:01, 38.74it/s]\u001b[A\n",
            "Validation DataLoader 0:  15% 12/79 [00:00<00:01, 38.35it/s]\u001b[A\n",
            "Validation DataLoader 0:  16% 13/79 [00:00<00:01, 37.97it/s]\u001b[A\n",
            "Validation DataLoader 0:  18% 14/79 [00:00<00:01, 37.46it/s]\u001b[A\n",
            "Validation DataLoader 0:  19% 15/79 [00:00<00:01, 37.47it/s]\u001b[A\n",
            "Validation DataLoader 0:  20% 16/79 [00:00<00:01, 37.60it/s]\u001b[A\n",
            "Validation DataLoader 0:  22% 17/79 [00:00<00:01, 37.58it/s]\u001b[A\n",
            "Validation DataLoader 0:  23% 18/79 [00:00<00:01, 37.57it/s]\u001b[A\n",
            "Validation DataLoader 0:  24% 19/79 [00:00<00:01, 37.00it/s]\u001b[A\n",
            "Validation DataLoader 0:  25% 20/79 [00:00<00:01, 36.49it/s]\u001b[A\n",
            "Validation DataLoader 0:  27% 21/79 [00:00<00:01, 36.60it/s]\u001b[A\n",
            "Validation DataLoader 0:  28% 22/79 [00:00<00:01, 36.40it/s]\u001b[A\n",
            "Validation DataLoader 0:  29% 23/79 [00:00<00:01, 36.45it/s]\u001b[A\n",
            "Validation DataLoader 0:  30% 24/79 [00:00<00:01, 36.62it/s]\u001b[A\n",
            "Validation DataLoader 0:  32% 25/79 [00:00<00:01, 36.49it/s]\u001b[A\n",
            "Validation DataLoader 0:  33% 26/79 [00:00<00:01, 36.57it/s]\u001b[A\n",
            "Validation DataLoader 0:  34% 27/79 [00:00<00:01, 36.67it/s]\u001b[A\n",
            "Validation DataLoader 0:  35% 28/79 [00:00<00:01, 36.51it/s]\u001b[A\n",
            "Validation DataLoader 0:  37% 29/79 [00:00<00:01, 36.33it/s]\u001b[A\n",
            "Validation DataLoader 0:  38% 30/79 [00:00<00:01, 36.07it/s]\u001b[A\n",
            "Validation DataLoader 0:  39% 31/79 [00:00<00:01, 35.91it/s]\u001b[A\n",
            "Validation DataLoader 0:  41% 32/79 [00:00<00:01, 35.52it/s]\u001b[A\n",
            "Validation DataLoader 0:  42% 33/79 [00:00<00:01, 35.32it/s]\u001b[A\n",
            "Validation DataLoader 0:  43% 34/79 [00:00<00:01, 35.22it/s]\u001b[A\n",
            "Validation DataLoader 0:  44% 35/79 [00:00<00:01, 35.12it/s]\u001b[A\n",
            "Validation DataLoader 0:  46% 36/79 [00:01<00:01, 34.99it/s]\u001b[A\n",
            "Validation DataLoader 0:  47% 37/79 [00:01<00:01, 34.78it/s]\u001b[A\n",
            "Validation DataLoader 0:  48% 38/79 [00:01<00:01, 34.65it/s]\u001b[A\n",
            "Validation DataLoader 0:  49% 39/79 [00:01<00:01, 34.19it/s]\u001b[A\n",
            "Validation DataLoader 0:  51% 40/79 [00:01<00:01, 34.14it/s]\u001b[A\n",
            "Validation DataLoader 0:  52% 41/79 [00:01<00:01, 34.04it/s]\u001b[A\n",
            "Validation DataLoader 0:  53% 42/79 [00:01<00:01, 33.80it/s]\u001b[A\n",
            "Validation DataLoader 0:  54% 43/79 [00:01<00:01, 33.72it/s]\u001b[A\n",
            "Validation DataLoader 0:  56% 44/79 [00:01<00:01, 33.67it/s]\u001b[A\n",
            "Validation DataLoader 0:  57% 45/79 [00:01<00:01, 33.57it/s]\u001b[A\n",
            "Validation DataLoader 0:  58% 46/79 [00:01<00:00, 33.52it/s]\u001b[A\n",
            "Validation DataLoader 0:  59% 47/79 [00:01<00:00, 33.46it/s]\u001b[A\n",
            "Validation DataLoader 0:  61% 48/79 [00:01<00:00, 33.16it/s]\u001b[A\n",
            "Validation DataLoader 0:  62% 49/79 [00:01<00:00, 33.11it/s]\u001b[A\n",
            "Validation DataLoader 0:  63% 50/79 [00:01<00:00, 33.08it/s]\u001b[A\n",
            "Validation DataLoader 0:  65% 51/79 [00:01<00:00, 32.98it/s]\u001b[A\n",
            "Validation DataLoader 0:  66% 52/79 [00:01<00:00, 32.94it/s]\u001b[A\n",
            "Validation DataLoader 0:  67% 53/79 [00:01<00:00, 32.91it/s]\u001b[A\n",
            "Validation DataLoader 0:  68% 54/79 [00:01<00:00, 32.82it/s]\u001b[A\n",
            "Validation DataLoader 0:  70% 55/79 [00:01<00:00, 32.75it/s]\u001b[A\n",
            "Validation DataLoader 0:  71% 56/79 [00:01<00:00, 32.71it/s]\u001b[A\n",
            "Validation DataLoader 0:  72% 57/79 [00:01<00:00, 32.58it/s]\u001b[A\n",
            "Validation DataLoader 0:  73% 58/79 [00:01<00:00, 32.58it/s]\u001b[A\n",
            "Validation DataLoader 0:  75% 59/79 [00:01<00:00, 32.58it/s]\u001b[A\n",
            "Validation DataLoader 0:  76% 60/79 [00:01<00:00, 32.57it/s]\u001b[A\n",
            "Validation DataLoader 0:  77% 61/79 [00:01<00:00, 32.57it/s]\u001b[A\n",
            "Validation DataLoader 0:  78% 62/79 [00:01<00:00, 32.57it/s]\u001b[A\n",
            "Validation DataLoader 0:  80% 63/79 [00:01<00:00, 32.49it/s]\u001b[A\n",
            "Validation DataLoader 0:  81% 64/79 [00:01<00:00, 32.50it/s]\u001b[A\n",
            "Validation DataLoader 0:  82% 65/79 [00:01<00:00, 32.51it/s]\u001b[A\n",
            "Validation DataLoader 0:  84% 66/79 [00:02<00:00, 32.48it/s]\u001b[A\n",
            "Validation DataLoader 0:  85% 67/79 [00:02<00:00, 32.43it/s]\u001b[A\n",
            "Validation DataLoader 0:  86% 68/79 [00:02<00:00, 32.44it/s]\u001b[A\n",
            "Validation DataLoader 0:  87% 69/79 [00:02<00:00, 32.40it/s]\u001b[A\n",
            "Validation DataLoader 0:  89% 70/79 [00:02<00:00, 32.37it/s]\u001b[A\n",
            "Validation DataLoader 0:  90% 71/79 [00:02<00:00, 32.35it/s]\u001b[A\n",
            "Validation DataLoader 0:  91% 72/79 [00:02<00:00, 32.40it/s]\u001b[A\n",
            "Validation DataLoader 0:  92% 73/79 [00:02<00:00, 32.37it/s]\u001b[A\n",
            "Validation DataLoader 0:  94% 74/79 [00:02<00:00, 32.37it/s]\u001b[A\n",
            "Validation DataLoader 0:  95% 75/79 [00:02<00:00, 32.35it/s]\u001b[A\n",
            "Validation DataLoader 0:  96% 76/79 [00:02<00:00, 32.34it/s]\u001b[A\n",
            "Validation DataLoader 0:  97% 77/79 [00:02<00:00, 32.34it/s]\u001b[A\n",
            "Validation DataLoader 0:  99% 78/79 [00:02<00:00, 32.33it/s]\u001b[A\n",
            "Epoch 2: 100% 860/860 [00:24<00:00, 35.33it/s, v_num=1, val_loss=0.182, val_acc=0.945]\n",
            "Epoch 2: 100% 860/860 [00:24<00:00, 35.32it/s, v_num=1, val_loss=0.182, val_acc=0.945]`Trainer.fit` stopped: `max_epochs=3` reached.\n",
            "Epoch 2: 100% 860/860 [00:24<00:00, 35.31it/s, v_num=1, val_loss=0.182, val_acc=0.945]\n"
          ]
        }
      ],
      "source": [
        "!python trainer.py --layer_1_dim 64 --devices 1 --max_epochs 3"
      ]
    },
    {
      "cell_type": "markdown",
      "source": [
        "## 参考\n",
        "https://lightning.ai/docs/pytorch/stable/common/hyperparameters.html"
      ],
      "metadata": {
        "id": "4mA1x5-CyOev"
      }
    },
    {
      "cell_type": "code",
      "source": [],
      "metadata": {
        "id": "j5OB_slGyRF_"
      },
      "execution_count": null,
      "outputs": []
    }
  ]
}